package com.javaGame.role.enemy;

import com.javaGame.frame.MainFrame;
import com.javaGame.role.Prop;
import com.javaGame.util.ImageChange;

import java.awt.*;

/**
 * 红色怪物
 */
public class RedEnemy extends EnemyRole {
    /**红色怪物图片*/
    public static Image[] redEnemyImg;
    /**图片切换对象*/
    private ImageChange imageChange = new ImageChange(3);

    public RedEnemy() {
        super((int)(Math.random()*200 + 1000),(int)(Math.random()*400+100),
                200, 230,100,150);
    }

    @Override
    public void move() {
        this.currentImg = imageChange.change(redEnemyImg);
        this.x -= 8;
    }

    private static int[] array = {0,0,0,0,0,1,1,1,2,2};
    /**
     * 产生爆炸
     */
    @Override
    public void addBomb(){
        super.addBomb();
        int index = (int)(Math.random()*10);
        MainFrame.roleList.add(new Prop(x,y,array[index]));
    }
}
